<?php

namespace app\admin\model\sales;

use think\Model;

/**
 * Salesanalysis
 */
class Salesanalysis extends Model
{
    // 表名
    protected $name = 'sales_salesanalysis';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = false;


    public function periodnoTable(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\fm\Periods::class, 'periodno', 'periodno');
    }

    public function custTable(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\sales\Debtorsmaster::class, 'cust', 'debtorno');
    }

    public function custbranchTable(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\sales\Custbranch::class, 'custbranch', 'branchcode');
    }

    public function stockidTable(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\stock\Stockmaster::class, 'stockid', 'stockid');
    }

    public function salespersonTable(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\sales\Salesman::class, 'salesperson', 'salesmancode');
    }

    public function stkcategoryTable(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\stock\Stockcategory::class, 'stkcategory', 'categoryid');
    }
}